<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>Building WinMerge Installer</title>
  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  <style type="text/css">
  <!--
    body {
      font-family: Verdana,Helvetica,Arial,sans-serif;
      font-size: small;
    }
    code,pre {
      font-family: "Courier New",Courier,monospace;
      font-size: 1em;
    }
    h3 {
      padding: 2px;
      border-left: 4px solid #FFCC00;
      border-bottom: 1px solid #FFCC00;
    }
    pre {
      margin-left: 25px;
      margin-right: 25px;
      padding: 5px;
      background-color: #EEEEEE;
      border-left: 10px solid #CCCCCC;
    }
  -->
  </style>
</head>
<body>

<h2>Building WinMerge Installer</h2>

<h3>Needed programs:</h3>
<ul>
  <li>
    <a href="http://www.jrsoftware.org/">Inno Setup</a> version 5.2.3.
  </li>
  <li>
    <a href="http://www.istool.org/">ISTool</a> <strong>recommended</strong>
    - great help managing Inno Setup installer scripts
  </li>
</ul>

<p>There is download package called "QuickStart Pack" available in Inno Setup
downloads. It contains all needed components in one installer.</p>

<h3>Installer script:</h3>
Installer script is in <code>Installer/InnoSetup</code> folder: <code>WinMerge.iss</code>

<h3>Checklist:</h3>
<ul>
  <li>
    Installer reads version number from <code>WinMergeU.exe</code>. So make
    sure you have version resource correctly set.<br>
    There is Python script <code>Tools/Scripts/SetVersions.py</code> which sets
    version numbers to all components. The script reads version numbers from
    <code>/versions.ini</code> file. See more info about the script from
    <code>Tools/Scripts/SetVersions.txt</code>
  </li>
  <li>
    Installer checks that files listed are present. But some files are
    included as folder (like <code>/Plugins/Dlls</code>) or as filemask (like
    <code>*.flt</code>) so take extra care to make sure all needed files
    are present in locations shown below.
  </li>
</ul>

<h3>Folder structure and files needed:</h3>
<p>First make sure you have all needed files compiled and available:
<ul>
  <li>WinMerge executable: <code>WinMergeU.exe</code></li>
  <li>Translation library: <code>MergeLang.dll</code></li>
  <li>Executable translations: <code>/Translations/WinMerge/*.po</code></li>
  <li>Libraries: <code>libexpat.dll</code> and <code>pcre.dll</code></li>
  <li>Manual: <code>WinMerge.chm</code></li>
  <li>ShellExtension: <code>ShellExtensionU.dll</code>
    and <code>ShellExtensionX64.dll</code></li>
  <li>Documents: <code>/Docs/Users/*</code></li>
  <li>Filters: <code>/Filters/*</code></li>
</ul>

<p>These files are produced by compiling WinMerge, documentation etc, but
that's not subject of this document, refer to <a href="Compiling.html">Compiling.html</a>,
<a href="readme-manual.html">readme-manual.html</a> and
<a href="Translations.html">Translations.html</a>.</p>

<p>In addition you will need Microsoft C- and MFC-runtime files. Those files are
not distributes with WinMerge. Older WinMerge installers copied those runtime
files to WinMerge program folder. But with VS 2005 and later this has caused a
lot of installing problems for users. So now we are embedding MS's own runtime
installer executable to our installer. This makes the installer executable
considerable bigger but seems to be the only reliable way to install those
runtime files.</p>

<p>You can download the latest VC2008 runtimes installer from MS:
<a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2051A0C1-C9B5-4B0A-A8F5-770A549FD78C">
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2051A0C1-C9B5-4B0A-A8F5-770A549FD78C</a><p>

<h4>Folder structure</h4>
<p>Copy or move the WinMerge files into the following layout (not runtimes):</p>

<ul>
 <li>
  <code>Build/</code>
  <ul>
    <li>
     <code>expat</code>
     <ul>
      <li><code>libexpat.dll</code></li>
     </ul>
    </li>
    <li>
     <code>Manual/htmlhelp</code>
     <ul>
      <li><code>WinMerge.chm</code></li>
     </ul>
    </li>
   <li>
    <code>MergeUnicodeRelease/</code>
    <ul>
     <li><code>MergeLang.dll</code></li>
     <li><code>ShellExtensionU.dll</code></li>
     <li><code>WinMergeU.exe</code></li>
    </ul>
   </li>
   <li>
    <code>pcre/</code>
    <ul>
      <li><code>pcre.dll</code></li>
    </ul>
   </li>
   <li>
    <code>ShellExtensionX64/</code>
    <ul>
      <li><code>ShellExtensionX64.dll</code></li>
    </ul>
   </li>
  </ul>
 </li>
 <li>
  <code>Docs/</code>
  <ul>
   <li>
    <code>Users</code>
    <ul>
     <li><em>Copy the entire <code>Docs/Users</code> folder to here</em></li>
    </ul>
   </li>
  </ul>
 </li>
 <li>
  <code>Filters/</code>
  <ul>
   <li><code>FileFilter.tmpl</code></li>
   <li><code>*.flt</code></li>
  </ul>
 </li>
 <li>
  <code>Installer/</code>
  <ul>
   <li>
    <code>InnoSetup/</code>
     <ul>
      <li><em>Copy the entire <code>Installer/InnoSetup</code> folder to here</em></li>
     </ul>
   </li>
  </ul>
 </li>
 <li>
  <code>Plugins/</code>
  <ul>
   <li>
    <code>dlls/</code>
     <ul>
      <li><em>Copy the entire <code>Plugins/dlls</code> folder to here</em></li>
     </ul>
   </li>
  </ul>
 </li>
 <li>
   <code>Translations/</code>
   <ul>
    <li>
     <code>Docs</code>
     <ul>
      <li><code>*.*</code></li>
     </ul>
    </li>
    <li>
     <code>WinMerge</code>
     <ul>
      <li><code>*.po</code></li>
     </ul>
    </li>
   </ul>
 </li>
</ul>

<p><strong>NOTE</strong><br>
If you don't need or can't compile <code>ShellExtensionX64.dll</code> component,
comment or remove line:</p>
<pre>; 64-bit version of ShellExtension
Source: ..\..\Build\ShellExtensionX64\ShellExtensionX64.dll; [...]
</pre>
<p>from <code>WinMerge.iss</code></p>

<h4>Runtime files installer</h4>
<p>Runtime files installer must be copied to the <code>Runtimes</code>-folder in same level
than WinMerge source tree folder is. Not <i>inside</i> source tree but
<i>outside</i> of the source tree.</p>

<h3>Running Inno Setup to create installer</h3>

<p><code>WinMerge.iss</code> (in <code>InnoSetup</code> folder)
is script used to create WinMerge installer.</p>

<p>Rest of this section assumes ISTool is used. If not, then refer to
InnoSetup manual for creating installer from script.</p>

<ol>
  <li>
    Start ISTool and load <code>WinMerge.iss</code>
  </li>
  <li>
    Select "Project-&gt;Verify Files..." from ISTool menu to verify
    all needed files are present and in correct directories. Copy missing
    files to correct directories before continuing.
  </li>
  <li>
    Select "Project-&gt;Compile Setup" from ISTool menu to create
    installer. This takes a while...
  </li>
</ol>

<p>If compile succeeds you have <code>WinMerge-[version]-Setup.exe</code> in
folder <code>/Build</code>. You probably want to remove unnecessary zeros
from the filename before uploading: if filename is <code>WinMerge-2.6.0.0-Setup.exe</code>,
you may want to rename it to <code>WinMerge-2.6-Setup.exe</code>. Not a rule, but a
recommendation.</p>

<p><strong>Test installer!</strong></p>

</body>
</html>